package com.appkubes.mall.admin.application.goods.goods.dao;

import com.appkubes.mall.admin.application.goods.goods.entity.dto.GoodsAssociateDTO;
import com.appkubes.mall.core.pojo.MallGoodsAssociateMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface GoodsAssociateDao extends MallGoodsAssociateMapper {

    @Select({"<script>",
            "SELECT b.*, a.associate_key FROM mall_goods_associate a " +
            "INNER JOIN mall_goods b ON a.associate_good_key=b.goods_key AND b.app_key=#{appKey} " +
            "WHERE a.good_key=#{goodKey}",
            "</script>"})
    public List<GoodsAssociateDTO> getList(@Param("goodKey") String goodKey, @Param("appKey") String appKey);
}
